/**
 */
package generalbookings.impl;

import generalbookings.GeneralbookingsPackage;
import generalbookings.Option;
import generalbookings.Property;
import generalbookings.Service;
import generalbookings.ServiceTime;

import java.util.Collection;

import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Service</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link generalbookings.impl.ServiceImpl#getOptions <em>Options</em>}</li>
 *   <li>{@link generalbookings.impl.ServiceImpl#getTimes <em>Times</em>}</li>
 *   <li>{@link generalbookings.impl.ServiceImpl#getProperties <em>Properties</em>}</li>
 *   <li>{@link generalbookings.impl.ServiceImpl#getServiceOptions <em>Service Options</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ServiceImpl extends NamedElementImpl implements Service {
	/**
	 * The cached value of the '{@link #getOptions() <em>Options</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getOptions()
	 * @generated
	 * @ordered
	 */
	protected EList<Option> options;

	/**
	 * The cached value of the '{@link #getTimes() <em>Times</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTimes()
	 * @generated
	 * @ordered
	 */
	protected EList<ServiceTime> times;

	/**
	 * The cached value of the '{@link #getProperties() <em>Properties</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getProperties()
	 * @generated
	 * @ordered
	 */
	protected EList<Property> properties;

	/**
	 * The cached value of the '{@link #getServiceOptions() <em>Service Options</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getServiceOptions()
	 * @generated
	 * @ordered
	 */
	protected EList<Option> serviceOptions;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ServiceImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return GeneralbookingsPackage.Literals.SERVICE;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<Option> getOptions() {
		if (options == null) {
			options = new EObjectContainmentEList<Option>(Option.class, this, GeneralbookingsPackage.SERVICE__OPTIONS);
		}
		return options;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<ServiceTime> getTimes() {
		if (times == null) {
			times = new EObjectContainmentEList<ServiceTime>(ServiceTime.class, this, GeneralbookingsPackage.SERVICE__TIMES);
		}
		return times;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<Property> getProperties() {
		if (properties == null) {
			properties = new EObjectContainmentEList<Property>(Property.class, this, GeneralbookingsPackage.SERVICE__PROPERTIES);
		}
		return properties;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<Option> getServiceOptions() {
		if (serviceOptions == null) {
			serviceOptions = new EObjectContainmentEList<Option>(Option.class, this, GeneralbookingsPackage.SERVICE__SERVICE_OPTIONS);
		}
		return serviceOptions;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case GeneralbookingsPackage.SERVICE__OPTIONS:
				return ((InternalEList<?>)getOptions()).basicRemove(otherEnd, msgs);
			case GeneralbookingsPackage.SERVICE__TIMES:
				return ((InternalEList<?>)getTimes()).basicRemove(otherEnd, msgs);
			case GeneralbookingsPackage.SERVICE__PROPERTIES:
				return ((InternalEList<?>)getProperties()).basicRemove(otherEnd, msgs);
			case GeneralbookingsPackage.SERVICE__SERVICE_OPTIONS:
				return ((InternalEList<?>)getServiceOptions()).basicRemove(otherEnd, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case GeneralbookingsPackage.SERVICE__OPTIONS:
				return getOptions();
			case GeneralbookingsPackage.SERVICE__TIMES:
				return getTimes();
			case GeneralbookingsPackage.SERVICE__PROPERTIES:
				return getProperties();
			case GeneralbookingsPackage.SERVICE__SERVICE_OPTIONS:
				return getServiceOptions();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case GeneralbookingsPackage.SERVICE__OPTIONS:
				getOptions().clear();
				getOptions().addAll((Collection<? extends Option>)newValue);
				return;
			case GeneralbookingsPackage.SERVICE__TIMES:
				getTimes().clear();
				getTimes().addAll((Collection<? extends ServiceTime>)newValue);
				return;
			case GeneralbookingsPackage.SERVICE__PROPERTIES:
				getProperties().clear();
				getProperties().addAll((Collection<? extends Property>)newValue);
				return;
			case GeneralbookingsPackage.SERVICE__SERVICE_OPTIONS:
				getServiceOptions().clear();
				getServiceOptions().addAll((Collection<? extends Option>)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case GeneralbookingsPackage.SERVICE__OPTIONS:
				getOptions().clear();
				return;
			case GeneralbookingsPackage.SERVICE__TIMES:
				getTimes().clear();
				return;
			case GeneralbookingsPackage.SERVICE__PROPERTIES:
				getProperties().clear();
				return;
			case GeneralbookingsPackage.SERVICE__SERVICE_OPTIONS:
				getServiceOptions().clear();
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case GeneralbookingsPackage.SERVICE__OPTIONS:
				return options != null && !options.isEmpty();
			case GeneralbookingsPackage.SERVICE__TIMES:
				return times != null && !times.isEmpty();
			case GeneralbookingsPackage.SERVICE__PROPERTIES:
				return properties != null && !properties.isEmpty();
			case GeneralbookingsPackage.SERVICE__SERVICE_OPTIONS:
				return serviceOptions != null && !serviceOptions.isEmpty();
		}
		return super.eIsSet(featureID);
	}

} //ServiceImpl
